home *** CD-ROM | disk | FTP | other *** search
/ MacAddict 123 / MacAddict_123_2006_11.iso / Software / Internet & Communication / GarageSale 2.4.4.dmg / GarageSale.app / Contents / Resources / Scripts / EntourageDelivery.applescript next >
Text File  |  2006-08-27  |  2KB  |  40 lines

  1. on sendMessage(inAdress, inSubject, inContent)
  2.     tell application "Microsoft Entourage"
  3.         activate
  4.         set inContent to my SearchReplace(inContent, (ASCII character 10) as Unicode text, (ASCII character 13) as Unicode text)
  5.         set theAdress to {address:{address:inAdress}, recipient type:to recipient}
  6.         set newMessage to make outgoing message at out box folder with properties {subject:inSubject, content:inContent, recipient:theAdress}
  7.         tell newMessage
  8.             open
  9.         end tell
  10.     end tell
  11. end sendMessage
  12.  
  13.  
  14. on sendMessageWithCc(inAdress, inSubject, inContent, inCc)
  15.     tell application "Microsoft Entourage"
  16.         activate
  17.         set theAdresses to {{address:{address:inAdress}, recipient type:to recipient}, {address:{address:inCc}, recipient type:cc recipient}}
  18.         set newMessage to make outgoing message at out box folder with properties {subject:inSubject, content:inContent, recipient:theAdresses}
  19.         tell newMessage
  20.             open
  21.         end tell
  22.     end tell
  23. end sendMessageWithCc
  24.  
  25.  
  26. on SearchReplace(mainString, searchString, replaceString)
  27.     -- keep searching while searchString is still found
  28.     considering case
  29.         repeat while mainString contains searchString
  30.             set foundOffset to offset of searchString in mainString
  31.             set temp to ""
  32.             set temp to (text 1 thru (foundOffset - 1) of mainString)
  33.             set temp to temp & replaceString
  34.             set temp to temp & (text (foundOffset + (count of searchString)) thru ((count of mainString) - 1) of mainString)
  35.             set mainString to ""
  36.             set mainString to temp
  37.         end repeat
  38.     end considering
  39.     return mainString
  40. end SearchReplace